import Vue from "vue";
import store from "@/store";
import server from "@/utils/axios.js";
const btnPermission = btnId => {
  return store.getters["User/BtnPermission"].includes(btnId);
};
/**
 * @description 判断按钮权限
 */
Vue.directive("btnper", {
  inserted: (el, binding) => {
    if (binding.value && el.parentNode && !btnPermission(binding.value)) {
      el.parentNode.removeChild(el);
    }
    //日志
    el.addEventListener("click", event => {
      server("System1", "ButtonLog", { btnid: binding.value });
    });
  }
});
Vue.prototype.$_btnper = btnPermission;
